package com.itheima.jdbc.homework;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

//- 添加：删除品牌
public class Test4 {
    public static void main(String[] args) throws SQLException {
        //- 删除一个品牌
       int id=6;
        delete(id);
    }

    private static int delete( int id) throws SQLException {
        Connection connection = Connectionpoor.getConnection();
        String sql="delete from tb_brand where id=?";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        preparedStatement.setInt(1, id);
        int i = preparedStatement.executeUpdate();
        preparedStatement.close();
        connection.close();
        return i;
    }


}
